package cn.iocoder.yudao.module.ride.dal.mysql.photo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ride.dal.dataobject.photo.PhotoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ride.controller.admin.photo.vo.*;

/**
 * 证件照片 Mapper
 *
 * @author 小胡同学
 */
@Mapper
public interface PhotoMapper extends BaseMapperX<PhotoDO> {

    default PageResult<PhotoDO> selectPage(PhotoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PhotoDO>()
                .eqIfPresent(PhotoDO::getDriverId, reqVO.getDriverId())
                .eqIfPresent(PhotoDO::getPersonPhoto, reqVO.getPersonPhoto())
                .eqIfPresent(PhotoDO::getIdFront, reqVO.getIdFront())
                .eqIfPresent(PhotoDO::getIdBack, reqVO.getIdBack())
                .eqIfPresent(PhotoDO::getIdHold, reqVO.getIdHold())
                .eqIfPresent(PhotoDO::getLicenseFront, reqVO.getLicenseFront())
                .eqIfPresent(PhotoDO::getCertPhoto, reqVO.getCertPhoto())
                .eqIfPresent(PhotoDO::getOther1, reqVO.getOther1())
                .eqIfPresent(PhotoDO::getOther2, reqVO.getOther2())
                .orderByDesc(PhotoDO::getId));
    }

}